//
//  Globals.h
//  CandyCrushClone
//
//  Created by Petar on 1/17/15.
//  Copyright (c) 2015 Nestorov Engineering. All rights reserved.
//

#import <Foundation/Foundation.h>

// iOS Detection
#define SYSTEM_VERSION_LESS_THAN(v)                 ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedAscending)
#define SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(v)  ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedAscending)

// Screen size Detection
#define SCREEN_WIDTH ([[UIScreen mainScreen] bounds].size.width)
#define SCREEN_HEIGHT ([[UIScreen mainScreen] bounds].size.height)
#define SCREEN_MAX_LENGTH (MAX(SCREEN_WIDTH, SCREEN_HEIGHT))

typedef NS_ENUM(NSUInteger, Cookies)
{
    ORANGE = 1,
    GREEN  = 2,
    PINK   = 3,
    BLUE   = 4,
    STAR   = 5,
    RED    = 6,
};


typedef NS_ENUM(NSUInteger, GameType)
{
    QUICK_GAME   = 1,
    FRIENDS_GAME = 2,
};

// Web Service IP ( To change the IPAddresses change PRIMARY_IP_KEY and SECONDARY_IP_KEY !!! )
static NSString* PRIMARY_IP_ADDRESS   = @"212.5.143.19"; // Petar
static NSString* PRIMARY_IP_KEY       = @"PetarIP";
static NSString* SECONDARY_IP_ADDRESS = @"212.5.143.222"; // Stefan
static NSString* SECONDARY_IP_KEY     = @"StefanIP";

static NSString* USERNAME_KEY           = @"username";
static NSString* PASSWORD_KEY           = @"password";
static NSString* CRYPTED_PASSWORD_KEY   = @"CPK";
static NSString* REGISTRATION_DATE_KEY  = @"RegistrationDate";
static NSString* GAME_ID_KEY            = @"GIDK";

// Commands
static NSString* CMD_START_NEW_GAME    = @"SNG";
static NSString* CMD_SEND_SWAP         = @"SS";
static NSString* CMD_MOVE_RESPONSE     = @"MR";
static NSString* CMD_REMATCH_GAME      = @"RG";
static NSString* CMD_USER_BUSY         = @"UB";

static NSString* CMD_JOIN_USER_TO_WAITING_LIST  = @"JUWL";
static NSString* CMD_GET_LIST_OF_USERS_FOR_NAME = @"GLUN";
static NSString* CMD_INVITE_USER_TO_BUDDYLIST   = @"IUTB";
static NSString* CMD_INVITE_BUDDY_TO_PLAY_GAME  = @"IBPG";
static NSString* CMD_GET_RANKING_LISTS          = @"GRL";
static NSString* CMD_CHANGE_CURRENT_PLAYER      = @"ChCuPl";
static NSString* CMD_UPDATE_MONEY_FOR_USER	    = @"UMFU";
static NSString* CMD_GET_AMOUNT_OF_MONEY	    = @"GAOM";
static NSString* CMD_RETURN_TO_LOBBY	        = @"RTL";
static NSString* CMD_FORCED_GAME_OVER			= @"FGO";
static NSString* CMD_PING_REQUEST			    = @"PR";
static NSString* CMD_UPGRADE_HERO			    = @"UH";
static NSString* CMD_GET_STORE_INFO	            = @"GSI";

static NSString* FRIENDS_RANKING_LIST  = @"FRL";
static NSString* WORLD_RANKING_LIST    = @"WRL";
static NSString* NAME                  = @"name";
static NSString* RANK                  = @"rank";
static NSString* WIN_PERCENTAGE        = @"WP";
static NSString* PLAYED_GAMES          = @"PG";
static NSString* MONEY_TO_UPDATE       = @"MTU";
static NSString* AMOUNT_OF_MONEY       = @"AOM";
static NSString* UPGRADE_TYPE          = @"UT";

static NSString* GAME_WIN_CONDITIONS     = @"GWC";
static NSString* ID_OF_CURRENT_PLAYER    = @"IDCP";
static NSString* FILL_HOLES_COOKIES      = @"FHC";
static NSString* TOP_UP_COOKIES   	     = @"TUC";
static NSString* MOVES_PARAMS	     	 = @"MoPa";
static NSString* STORE_PURCHASES_REWARDS = @"SPR";
static NSString* STORE_UPGRADE_PRICES    = @"SUP";

// Cookies
static  NSString* COOKIES_SET         = @"CS";
static  NSString* ROW			      = @"Ro";
static  NSString* COLUMN 		      = @"Co";
static  NSString* COOKIE_TYPE 	      = @"CT";
static  NSString* SHUFFLE_COOKIES_SET = @"SCS";
static  NSString* CURRENT_COOKIES_SET = @"CCS";

static  NSString* SWAP_COOKIE_A  = @"SCA";
static  NSString* SWAP_COOKIE_B  = @"SCB";
static  NSString* SWAP_OBJECT	 = @"SO";
static  NSString* PLAYER_TO_MOVE = @"PTM";

static  NSString* FIRST_PLAYER_INFO  = @"FPI";
static  NSString* SECOND_PLAYER_INFO = @"SPI";
static  NSString* IS_GAME_OVER		 = @"IGO";
static  NSString* WINNER_ID			 = @"WID";


// Notifications
static  NSString* BEGIN_GAME              = @"kBeginGame";
static  NSString* RECEIVED_RESPONSE	      = @"kReceivedResponse";
static  NSString* PERFORM_SWAP            = @"kPerformSwap";
static  NSString* UPDATE_LIST_OF_USERS    = @"kUpdateListOfUses";
static  NSString* UPDATE_RANKING_LISTS    = @"kUpdateRankingLists";
static  NSString* LOGGED_IN               = @"kLoggedIn";
static  NSString* CLEAN_SCENE             = @"kCleanScene";
static  NSString* DISMISS_REGISTRATION_VC = @"kDismissRegistrationVC";

// Invitations
static  NSString* INVITATION_TYPE       = @"INVT";
static  NSString* INVITATION_TYPE_GAME  = @"INVG";
static  NSString* INVITATION_TYPE_BUDDY = @"INVB";
static  NSString* INVITEE_NAME          = @"IVEN";
static  NSString* USER_BUSY_MESSAGE     = @"UBM";

static  NSString* USERNAME           = @"USRN";
static  NSString* LIST_OF_USER_NAMES = @"LOUN";

// Bots
static  NSString* BOT_NAME			 = @"botName";
static  NSInteger BOT_ID			 = -1;
static  NSString* BOT_WINS           = @"botWins";
static  NSString* BOT_LOSSES         = @"botLosses";
static  NSString* BOT_RANK           = @"botRank";
static  NSString* BOT_HERO_TYPE      = @"botHeroType";
static  NSString* BOT_HERO_PRODUCES  = @"botHeroProduces";
static  NSString* BOT_HERO_ATTACK    = @"botHeroAttack";

// Hero
static  NSString* HERO_WAVE_INFO	            = @"HWI";
static  NSString* SHOULD_USE_HERO               = @"SUH";
static  NSString* HERO_TYPE			            = @"HT";
static  NSString* FIRST_PLAYER_HERO_INFO        = @"FPHI";
static  NSString* SECOND_PLAYER_HERO_INFO       = @"SPHI";
static  NSString* FIRST_PLAYER_HERO_CONDITIONS  = @"FPHC";
static  NSString* SECOND_PLAYER_HERO_CONDITIONS = @"SPHC";
static  NSString* CHOSEN_HERO_TYPE              = @"CHT";
static  NSString* CHOSEN_HERO_PRODUCES          = @"CHP";
static  NSString* CHOSEN_HERO_ATTACK            = @"CHA";
static  NSString* HERO_CONDITIONS               = @"HC";
static  NSString* PLAYER_ID                     = @"PID";
static  NSString* HERO_INFO_ARRAY_KEY           = @"HIAK";
static  NSInteger UPGRADE_PRODUCES_TYPE         = 1;
static  NSInteger UPGRADE_ATTACK_TYPE           = 2;

static  NSString* FIRST_PLAYER_HERO_SKILLS_ON_MYSELF        = @"FPHSM";
static  NSString* FIRST_PLAYER_HERO_SKILLS_ON_OTHER_PLAYER  = @"FPHSOP";
static  NSString* SECOND_PLAYER_HERO_SKILLS_ON_MYSELF       = @"SPHSM";
static  NSString* SECOND_PLAYER_HERO_SKILLS_ON_OTHER_PLAYER = @"SPHSOP";
static  NSString* HERO_SKILLS_ON_MYSELF                     = @"HSM";
static  NSString* HERO_SKILLS_ON_OTHER_PLAYER               = @"HSOP";

// EnergyManager
static NSString* LAST_ENERGY_REPLENISHMENT_DATE_KEY = @"lastEnergyReplenishmentDate";
static NSString* kEnergyManagerEnergyReplenished    = @"kEnergyManagerEnergyReplenished";
static NSString* MAX_ENERGY_KEY                     = @"maxEnergy";
static NSString* CURRENT_ENERGY_KEY                 = @"currentEnergy";
static NSInteger TIME_TO_SPAWN_ENERGY               = 30 * 60;
static NSInteger INCREASED_STORAGE_SIZE  = 50;
static NSString* IS_PURCHASED_UNLIMITED_ENERGY_KEY = @"kIsPurchasedUnlimitedEnergy";

static float ADDITIONAL_DELAY_FOR_ONE_WAVE      = 1.5;

// NSUserDefaults keys
static  NSString* LAST_UPDATED_VERSION_KEY = @"kLastUpdatedVersion";
static  NSString* USER_MONEY_KEY = @"kLastUpdatedVersion";

// In-App Purchases
static NSInteger NUMBER_OF_PRODUCTS = 6;
static NSString* OFFER_1 = @"com.NestorovEngineering.FirstMatchThree.Offer_1";
static NSString* OFFER_2 = @"com.NestorovEngineering.FirstMatchThree.Offer2";
static NSString* OFFER_3 = @"com.NestorovEngineering.FirstMatchThree.Offer3";
static NSString* OFFER_4 = @"com.NestorovEngineering.FirstMatchThree.Offer4";
//static NSString* OFFER_5 = @"com.NestorovEngineering.FirstMatchThree.Offer5";
//static NSString* OFFER_6 = @"com.NestorovEngineering.FirstMatchThree.Offer6";


// Audio
#define kButtonClickSound @"ButtonClickSound1.wav"
#define kCountPointsLongSound @"CountPointsSound.wav"
#define kCountPointsShortSound @"CountPointsShortSound.wav"
#define kCoinsExplosionSound @"CoinsExplosionSound.wav"
#define kWinSound @"WinSound.wav"
#define kLoseSound @"LoseSound.wav"
#define kMatch4or5CookiesSound @"Match4or5CookiesSound.wav"
#define kClockTickSound @"ClockTick.wav"
#define kUpgradeSound @"UpgradeSound.wav"
#define kCandiesFireworksSound @"CandiesFireworksSound2.wav"
#define kBuyHeroSound @"BuyHeroSound.wav"
#define kLoopBGMusic @"LoopBGMusic.mp3"
#define kShowBannerSound @"ShowBannerSound.wav"
#define kSearchingSound @"SearchingSound.wav"
#define kShowFlashSound @"ShowFlashSound.wav"


#define kSoundFiles @[kButtonClickSound, kCountPointsLongSound, kCountPointsShortSound,kCoinsExplosionSound, kWinSound, kLoseSound, kClockTickSound, kUpgradeSound, kCandiesFireworksSound, kBuyHeroSound, kLoopBGMusic, kShowBannerSound, kMatch4or5CookiesSound, kSearchingSound, kShowFlashSound ]

@interface Globals : NSObject

@end
